//
//  UIView+Extension.m
//  Practice
//
//  Created by yons on 14.8.20.
//  Copyright © 2020 yons. All rights reserved.
//

#import "UIView+Extension.h"

@implementation UIView (Extension)

/// 背景色
/// @param backgroundColor 颜色
+ (UIView *)viewWithBackgroundColor:(UIColor *)backgroundColor {
    UIView *view = [[UIView alloc] init];
    view.backgroundColor = backgroundColor;
    return view;
}

/// 背景色+剪切半径
/// @param backgroundColor 背景色
/// @param radius 剪切半径
+ (UIView *)viewWithBackgroundColor:(UIColor *)backgroundColor radius:(CGFloat)radius {
    UIView *view = [self viewWithBackgroundColor:backgroundColor];
    view.layer.cornerRadius = radius;
    return view;
}

/// 背景色+剪切半径+边框宽度+边框颜色
/// @param backgroundColor 背景色
/// @param radius 剪切半径
/// @param borderWidth 边框宽度
/// @param borderColor 边框颜色
+ (UIView *)viewWithBackgroundColor:(UIColor *)backgroundColor radius:(CGFloat)radius borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor {
    UIView *view = [self viewWithBackgroundColor:backgroundColor radius:radius];
    view.layer.borderWidth = borderWidth;
    view.layer.borderColor = borderColor.CGColor;
    return view;
}

@end
